/*************************************************************************
** Copyright (C) 2014  Mario Marquez <maqzma@gmail.com>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
*************************************************************************/

#ifndef STESTRUNNER_H
#define STESTRUNNER_H

#include <QtCore/QObject>

/**
 * Utiliza el framework QTestlib para ejecuta una lista de objetos test.
 *
 * Los test son ejecutados consecutivamente uno tras otro. En caso
 * de que falle alguno, el proceso de ejecutado se detiene. Esto
 * ultimo puede anularce alterando la propiedad 'continuous'.
 *
 * El estado por defecto de 'continuous' es falso y por ende al cambiar
 * su valor por verdadero, los test se seguiran ejecutando sin importar
 * si alguno falla.
 */
class STestRunner : public QObject
{
public:
    STestRunner(int argc, char **argv, QObject *parent = 0);

    void addTest(QObject *test);
    void removeTest(QObject *test);

    void setContinuous(bool continuous);
    bool continuous() const;

    void runTests();

private:
    int _argc;
    char **_argv;

    bool _continuous;

    QList<QObject *> _tests;
};

#endif // STESTRUNNER_H
